package com.yuan.base.service.infrastructure.metric;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lintiangang
 * @date 2021/03/26 09:24
 **/
@Configuration
public class MetricsConfig {

    @Value("${spring.application.name}")
    private String serviceName;

    @Bean
    MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
        return registry -> registry.config().commonTags("application", serviceName);
    }
}
